<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<TransactionResult>" %>
<%@ Import Namespace="CSI.Directory.Core.Model"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <title>Login</title>
    
    <script type="text/javascript">
    $(document).ready(function() {

       $("input").bind("keydown", function(event) {
          // track enter key
          var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
          if (keycode == 13) { // keycode for enter key
             // force the 'Enter Key' to implicitly click the Update button
             Login();
             return false;
          } else  {
             return true;
          }
           }); // end of function

    }); // end of document ready

    function Login(){
        if(document.loginForm.username.value != "" && document.loginForm.username.value.length > 2
        && document.loginForm.password.value != "" && document.loginForm.password.value.length > 5)
        {
            document.loginForm.submit();
        }else{
            $("#error").html("Please complete all fields.");
        }
    }
    </script>
</head>
<body style="background-color:#333;color:White;font:normal normal 500 9pt Verdana">
    <center style="margin-top:20%">
    <form action="/Directory/Login/ManagementAuthenticate" method="post" name="loginForm">
    <fieldset style="width:400px">
    <legend style="font:normal normal 800 12pt Verdana;color:white">C3 Platform</legend>
        <table cellpadding="5" cellspacing="5" >
            <tr>
                <td align="left">Username
                </td>
                <td align="left"><input type="text" name="username" id="username" class="" style="width:150px" />
                </td>
            </tr>
            <tr>
                <td align="left">Password
                </td>
                <td align="left"><input type="password" name="password" id="password" class="" style="width:150px" />
                </td>
            </tr>
            <tr>
                <td align="left">Remember me
                </td>
                <td valign="top"  align="left">
                    <%if (HttpContext.Current.User.Identity.IsAuthenticated){ %>
                        <input type="checkbox" name="remember" id="remember" checked="checked"/>
                    <%}else{%>
                        <input type="checkbox" name="remember" id="Checkbox1" />
                    <%} %>(Do not check on public computers)
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td> 

                </td>
            </tr>
            <tr>
                <td align="left"><a href="" onclick="Login();return false;" style="color:white" >login</a>
                </td>
                <td> 

                </td>
            </tr>
        </table>
    </fieldset>
    </form>    
    <br />
    <div id="error" style="color:red"><%=(Model == null) ? string.Empty : Model.Exception %></div>
    </center>
</body>
</html>